unit ChequeDM;

{$mode objfpc}{$H+}

interface

uses
 Classes, SysUtils, DB, FileUtil, LResources, Forms, Controls, Graphics,
  Dialogs, ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions;

type

  { TChequeData }

    TChequeData = class(TMainDataModule)
    ChequeDatasource: TDatasource;
    ChequeZQuerydata_vencimento: TDateField;
    ChequeZQueryid_cheque: TLargeintField;
    ChequeZQueryid_cliente: TLargeintField;
    ChequeZQueryid_duplicata_receber: TLargeintField;
    ChequeZQueryid_venda: TLargeintField;
    ChequeZQuerynumero_agencia: TStringField;
    ChequeZQuerynumero_banco: TStringField;
    ChequeZQuerynumero_cheque: TStringField;
    ChequeZQuerynumero_conta: TStringField;
    ChequeZQuerysituacao_cheque: TStringField;
    ChequeZQueryvalor: TFloatField;
    ChequeZSequence: TZSequence;
    ChequeZUpdate: TZUpdateSQL;
    ChequeZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  end;

var
  ChequeData: TChequeData;

implementation

uses ConnectionDM;

{ TChequeData }


procedure TChequeData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := ChequeZQuery;
end;


procedure TChequeData.OpenDataSet;
begin
  ConnectionData.EmptyQuery(ChequeZQuery, 'cheque');
end;

procedure TChequeData.CloseDataSet;
begin
  ChequeZQuery.Close();
end;

procedure TChequeData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(ChequeZQuery, Tabela, Condicoes);
end;

initialization
  {$I chequedm.lrs}

end.

